Multiple actions


In real web server programming you need to write multiple actions for different
requests. For instance if you need to write a telephone directory which contains
search and subscription forms you didn't need to write two web applications: one
for search and one for subscription such as:

http://MyServer/WebSer/search.exe

http://MyServer/WebSer/sub.exe

Instead you can write only one web application and create two web item actions,
the first one can be called
waSearch and the other waSub. waSearch contains /search in
it's
PathInfo property and waSub contains /sub in it's PathInfo. PathInfo property
makes your web server respond to your request according to passed path, for example
if you pass below URL to your application:


http://MyServer/WebSer/phone.exe/search

The first action will be executed (waSearch), and if you pass below URL:

http://MyServer/WebSer/phone.exe/sub

The second action will be executed to respond to your request.

You can combine PathInfo with parameters such as:

http://MyServer/WebSer/phone.exe/search?name=Motaz

Returned value of Query property of Request will be: "
name=Motaz"

By this method you can write only one web server application to respond to multiple
HMTL forms and queries.

There is a complete code of Telephone directory application with this article. Copy
this sample to a directory and make a WWW Alias for it. Make sure that read and execute
permission is checked for that Alias.

There is a third action in this example called waAll which returns all records.
To call this action write:

http://MyServer/WebSer/phone.exe/all



Phone.zip